<template>
  <div class="Header" :class="{MyHeader:this.$route.path=='/My' ,MyLogin:this.$route.path=='/Login'}">
    <!-- 购物车头部   -->
    <div class="cardHeader" :class="{Login:this.$route.path=='/Login'}">
      <div class="cardHeader-left" @click="back()">
        <div></div>
      </div>
      <div class="cardHeader-center" :class="{LoginCenter:this.$route.path=='/Login'}"><span>{{Header}}</span></div>
      <div class="cardHeader-right" v-if="this.$route.path!='/Login'" >
        <div></div>
      </div>
    </div>


    <!--购物车地址    -->
    <div class="cardSite" v-if="this.$route.path==='/ShopCard'">
      <div class="cardSite-left">
          <div>
            {{area}}
          </div>
      </div>
      <div class="cardSite-right">
        <div>
          编辑商品
        </div>
      </div>
    </div>

  </div>

</template>

<script>
export default {
  name: "cardHeader",
  data:()=>({
    area:'湛江市廉江市',
    Header:''
  }),
  methods:{
    header(){
      if(this.$route.path === '/ShopCard'){
          this.Header='购物车';
      }
      if(this.$route.path === '/My'){
        this.Header='我的京东';
      }
      if(this.$route.path === '/Login'){
        this.Header='京东登录注册';
      }
    },
    back(){
      this.$router.go(-1);
    }
  },
  mounted() {
    this.header();
  }
}
</script>

<style scoped>
  .Header{
    padding-bottom: 0.3125rem;
    display: flex;
    flex-wrap: wrap;
    justify-content:space-between ;
    height:6.75rem;
  }
  .cardHeader{
    width: 100vw;
    height:2.75rem;
    display: flex;
    justify-content: space-between;
    background:#FFFFFF;
    border-bottom: 1px solid #F2F2F2;

  }
  .cardHeader-left div{
    width: 1.25rem;
    height: 1.25rem;
    background: url("") no-repeat;
    background-size:100% ;
  }
  .cardHeader-right div{
    width: 1.25rem;
    height: 1.25rem;
    background:url("") no-repeat 50% ;
    background-size: 100%;
  }
  .cardHeader-left,.cardHeader-right{
    width: 2.75rem;
    height: 2.75rem;
    display: flex;
    justify-content: center;
    align-items: center;
  }
  .cardHeader-center{
    font-size: 1.125rem;
    display: flex;
    align-items: center;
  }
  .cardSite{
    width: calc(100vw - 2rem);
    height: 3.125rem;
    background: #FFFFFF;
    border-bottom-left-radius:1rem;
    border-bottom-right-radius:1rem;
    padding: 0 1rem;

    display: flex;
    white-space: nowrap;
    font-size: 0.875rem;

    align-items: center;
  }
  .cardSite-left{
    width: 16.8125rem;
    text-align: left;
    position: relative;
    padding-left: 1.25rem;
  }
  .cardSite-right{
    width: 3.25rem;
    flex-wrap: nowrap;
  }
  .cardSite-left:before {
    content: "";
    position: absolute;
    top: 50%;
    left: 0;
    margin-top: -0.375rem;
    background: url(//wq.360buyimg.com/wxsq_trade/cart/main/images/icon_location_jd@2x_d0e3eb69.png);
    background-size: 0.75rem 0.75rem;
    width: 0.75rem;
    height: 0.75rem;
  }
  .cardSite-left:after {
    content: "";
    position: absolute;
    width: 0.0625rem;
    height: 0.625rem;
    background: #bfbfbf;
    top: 50%;
    right: 0;
    margin-top: -.2rem;
  }
  .MyHeader{
    height: 2.8125rem;
    padding-bottom: 0rem;
  }
  .Login{
    justify-content: left;
  }
  .LoginCenter{
   margin-left: 5.4375rem;
    
  }
  .MyLogin{
    height: 2.8125rem;
  }
</style>